import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_changdian_football/pages/clubs/player_info/player_info_controller.dart';
import 'package:flutter_changdian_football/utils/custom_constant.dart';
import 'package:flutter_changdian_football/utils/str_utils.dart';
import 'package:flutter_changdian_football/widget/default_page/custom_empty.dart';
import 'package:flutter_changdian_football/widget/dialog/absenteeism_dialog.dart';
import 'package:flutter_changdian_football/widget/dialog/manage_dialog.dart';
import 'package:flutter_changdian_football/widget/extended_image_slide_widget.dart';
import 'package:flutter_changdian_football/widget/load_state/load_state_layout.dart';
import 'package:flutter_changdian_football/widget/screenutil/custom_screenutil.dart';
import 'package:flutter_changdian_football/widget/sheet/share_icon_sheet.dart';
import 'package:get/get.dart';

/// 球员信息
class PlayerInfoPage extends StatelessWidget {
  const PlayerInfoPage({
    super.key,
    this.queriedUserId = '',
    this.type = CustomConstant.USER_JB_INFO,
    this.isOperate = 'false',
    this.clubId = ''
  });

  final String queriedUserId;
  final String type;
  final String isOperate;
  final String clubId;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xffF8FAF9),
      body: GetBuilder<PlayerInfoController>(
        init: PlayerInfoController(queriedUserId: queriedUserId, type: type, clubId: clubId),
        builder: (playerInfoController) {
          return _buildScaffoldBody(playerInfoController, context);
        }
      ),
    );
  }


  Widget _buildScaffoldBody(PlayerInfoController playerInfoController, context) {
    final double statusBarHeight = MediaQuery.of(context).padding.top;
    final double pinnedHeaderHeight = statusBarHeight + kToolbarHeight;
    return LoadStateLayout(
      state: playerInfoController.state,
      empty: Scaffold(
        backgroundColor: Colors.white,
        appBar: AppBar(
          centerTitle: true,
          backgroundColor: const Color(0xffF8FAF9),
          elevation: 0,
          title: Text(
            '用户信息',
            style: TextStyle(fontSize: 16.sp, color: const Color(0xff333333)),
          ),
          iconTheme: const IconThemeData(
            color: Color(0xff333333)
          ),
        ),
        body: const Center(
          child: CustomEmpty(
            text: '暂无此用户信息',
          ),
        ),
      ),
      success: ExtendedNestedScrollView(
        controller: playerInfoController.scrollController,
        headerSliverBuilder: (BuildContext c, bool f) {
          return <Widget>[
            SliverAppBar(
              pinned: true,
              expandedHeight: 180.w,
              title: Text(playerInfoController.titleAlpha <= 180 ? '' : playerInfoController.userDetailModel?.nickname ?? '', style: TextStyle(fontSize: 16.sp, color: playerInfoController.titleAlpha <= 180 ? Colors.white : const Color(0xff333333)),),
              iconTheme: IconThemeData(
                color: playerInfoController.titleAlpha <= 180 ? Colors.white : const Color(0xff333333)
              ),
              actions: [
                if (playerInfoController.userDetailModel?.isSelf == true) ...[
                  const SizedBox()
                ] else if (type == CustomConstant.USER_JB_INFO) ...[
                  IconButton(
                    onPressed: () {
                      playerInfoController.getSharePage();
                    }, 
                    icon: SizedBox(
                      width: 22.w,
                      height: 22.w,
                      child: Image.asset('assets/images/share_qr.png', color: Colors.white,),
                    )
                  )
                ] else if (isOperate == 'true') ...[
                  Container(
                    alignment: Alignment.centerRight,
                    margin: EdgeInsets.only(right: 17.w),
                    child: GestureDetector(
                      behavior: HitTestBehavior.translucent,
                      onTap: () {
                        _showMenu(playerInfoController);
                      },
                      child: SizedBox(
                        width: 30.w,
                        height: 30.w,
                        child: Image.asset('assets/images/ddd.png', fit: BoxFit.fill, color: playerInfoController.titleAlpha <= 180 ? Colors.white : const Color(0xff333333),),
                      ),
                    ),
                  )
                ]
              ],
              centerTitle: true,
              elevation: 0.0,
              backgroundColor: const Color(0xffF8FAF9),
              flexibleSpace: FlexibleSpaceBar(
                collapseMode: CollapseMode.pin,
                background: Column(
                  children: [
                    Stack(
                      clipBehavior: Clip.none,
                      alignment: Alignment.center,
                      children: [
                        SizedBox(
                          width: double.infinity,
                          height: 200.w,
                          child: Image.asset('assets/images/icon_pinfo_bg.png', fit: BoxFit.fill,),
                        ),

                        Positioned(
                          bottom: 20.w,
                          child: SizedBox(
                            width: MediaQuery.of(context).size.width - 34.w,
                            child: Row(
                              children: [
                                Expanded(
                                  child: Row(
                                    children: [
                                      GestureDetector(
                                        behavior: HitTestBehavior.translucent,
                                        onTap: () {
                                          if (playerInfoController.userDetailModel?.imageUrl != null) {
                                            Get.to(
                                              ExtendedImageSlideWidget(
                                                url: "${playerInfoController.userDetailModel?.imageUrl ?? ''}",
                                              ),
                                              opaque: false
                                            );
                                          }
                                        },
                                        child: Container(
                                          width: 56.w,
                                          height: 56.w,
                                          decoration: BoxDecoration(
                                            borderRadius: BorderRadius.circular(74.r)
                                          ),
                                          child: ClipRRect(
                                            borderRadius: BorderRadius.circular(74.r),
                                            child: Image.network(playerInfoController.userDetailModel?.imageUrl ?? '', fit: BoxFit.fill,),
                                          ),
                                        ),
                                      ),

                                      SizedBox(width: 10.w,),

                                      SizedBox(
                                        child: Column(
                                          crossAxisAlignment: CrossAxisAlignment.start,
                                          children: [
                                            SizedBox(
                                              child: Row(
                                                children: [
                                                  SizedBox(
                                                    child: Text(playerInfoController.userDetailModel?.nickname ?? '', style: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.w400, color: Colors.white),),
                                                  ),
                                                  // SizedBox(width: 8.w,),
                                                  // SizedBox(
                                                  //   width: 14.w,
                                                  //   height: 14.w,
                                                  //   child: playerInfoController.userDetailModel?.sex == '1' || playerInfoController.userDetailModel?.sex == '女' ? Image.asset(StrUtils.getSexImage(
                                                  //     int.parse('${playerInfoController.userDetailModel?.sex == '1' || playerInfoController.userDetailModel?.sex == '女' ? '1' : '2'}')),
                                                  //   ) : Image.asset(StrUtils.getSexImage(
                                                  //     int.parse('${playerInfoController.userDetailModel?.sex == '1' || playerInfoController.userDetailModel?.sex == '女' ? '1' : '2'}'),),
                                                  //     color: Colors.white,
                                                  //   ),
                                                  // )
                                                ],
                                              ),
                                            ),

                                            SizedBox(height: 6.w,),

                                            SizedBox(
                                              width: 69.w,
                                              height: 18.w,
                                              child: Image.asset(StrUtils.getLevelImage(2)),
                                            ),
                                          ],
                                        ),
                                      )
                                    ],
                                  ),
                                ),




                                if (playerInfoController.userDetailModel?.isSelf != true) ...[
                                  SizedBox(
                                    child: Row(
                                      children: [
                                        GestureDetector(
                                          behavior: HitTestBehavior.translucent,
                                          onTap: () {
                                            playerInfoController.praiseOrCancelPraise();
                                          },
                                          child: Container(
                                            decoration: BoxDecoration(
                                              color: playerInfoController.userDetailModel?.isPraised == true ? Colors.transparent : Colors.white,
                                              borderRadius: BorderRadius.circular(129.r),
                                              border: Border.all(
                                                width: 1.w,
                                                color: Colors.white
                                              )
                                            ),
                                            padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 6.w),
                                            child: Text(playerInfoController.userDetailModel?.isPraised == true ? '点赞' : '已点赞', style: TextStyle(fontSize: 12.sp, color: playerInfoController.userDetailModel?.isPraised == true ? Colors.white : const Color(0xff2A8747)),),
                                          ),
                                        ),


                                        SizedBox(width: 6.w,),


                                        if (playerInfoController.userDetailModel?.isFocused == true) ...[
                                          GestureDetector(
                                            behavior: HitTestBehavior.translucent,
                                            onTap: () {
                                              playerInfoController.focusOrCancelFocus();
                                            },
                                            child: Container(
                                              decoration: BoxDecoration(
                                                color: Colors.transparent,
                                                borderRadius: BorderRadius.circular(129.r),
                                                border: Border.all(
                                                  width: 1.w,
                                                  color: Colors.white
                                                )
                                              ),
                                              padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 6.w),
                                              child: Text('已关注', style: TextStyle(fontSize: 12.sp, color: Colors.white),),
                                            ),
                                          ),
                                        ] else ...[
                                          GestureDetector(
                                            behavior: HitTestBehavior.translucent,
                                            onTap: () {
                                              playerInfoController.focusOrCancelFocus();
                                            },
                                            child: Container(
                                              decoration: BoxDecoration(
                                                color: const Color(0xffFF6750),
                                                borderRadius: BorderRadius.circular(129.r),
                                                border: Border.all(
                                                  width: 1.w,
                                                  color: const Color(0xffFF6750),
                                                )
                                              ),
                                              padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 6.w),
                                              child: Row(
                                                children: [
                                                  Icon(Icons.add, size: 14.sp, color: Colors.white,),
                                                  SizedBox(width: 3.w),
                                                  Text('关注', style: TextStyle(fontSize: 12.sp, color: Colors.white),)
                                                ],
                                              ),
                                            ),
                                          )
                                        ]


                                        
                                      ],
                                    )
                                  )
                                ],
                               
                               
                                // Stack(
                                //   clipBehavior: Clip.none,
                                //   children: [
                                //     Container(
                                //       width: 56.w,
                                //       height: 56.w,
                                //       decoration: BoxDecoration(
                                //         borderRadius: BorderRadius.circular(74.r)
                                //       ),
                                //       child: ClipRRect(
                                //         borderRadius: BorderRadius.circular(74.r),
                                //         child: Image.network(playerInfoController.userDetailModel?.imageUrl ?? '', fit: BoxFit.fill,),
                                //       ),
                                //     ),

                                    // Positioned(
                                    //   bottom: 0.w,
                                    //   left: 37.w,
                                    //   child: SizedBox(
                                    //     child: Row(
                                    //       crossAxisAlignment: CrossAxisAlignment.end,
                                    //       children: [
                                    //         SizedBox(
                                    //           width: 70.w,
                                    //           height: 16.w,
                                    //           child: Image.asset(StrUtils.getLevelImage(2)),
                                    //         ),
                                    //         SizedBox(width: 10.w,),

                                    //         SizedBox(
                                    //           child: Row(
                                    //             children: [
                                    //               SizedBox(
                                    //                 child: Text(playerInfoController.userDetailModel?.nickname ?? '', style: TextStyle(fontSize: 18.sp, color: const Color(0xff323232)),),
                                    //               ),
                                    //               SizedBox(width: 6.w,),
                                    //               SizedBox(
                                    //                 width: 14.w,
                                    //                 height: 14.w,
                                    //                 child: Image.asset(StrUtils.getSexImage(
                                    //                   int.parse('${playerInfoController.userDetailModel?.sex == '1' || playerInfoController.userDetailModel?.sex == '女' ? '1' : '2'}'))
                                    //                 ),
                                    //               )
                                    //             ],
                                    //           ),
                                    //         )
                                    //       ],
                                    //     ),
                                    //   )
                                    // )
                                  // ],
                                // ),
                              ],
                            ),
                          )
                        )
                      ]
                    )

                    //     Positioned(
                    //       bottom: -37.w,
                    //       left: 17.w,
                    //       child: SizedBox(
                    //         width: MediaQuery.of(context).size.width - 34.w,
                    //         child: Row(
                    //           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    //           crossAxisAlignment: CrossAxisAlignment.start,
                    //           children: [
                    //             Stack(
                    //               clipBehavior: Clip.none,
                    //               children: [
                    //                 Container(
                    //                   width: 74.w,
                    //                   height: 74.w,
                    //                   decoration: BoxDecoration(
                    //                     borderRadius: BorderRadius.circular(74.r)
                    //                   ),
                    //                   child: ClipRRect(
                    //                     borderRadius: BorderRadius.circular(74.r),
                    //                     child: Image.network(playerInfoController.userDetailModel?.imageUrl ?? '', fit: BoxFit.fill,),
                    //                   ),
                    //                 ),

                    //                 Positioned(
                    //                   bottom: 0.w,
                    //                   left: 37.w,
                    //                   child: SizedBox(
                    //                     child: Row(
                    //                       crossAxisAlignment: CrossAxisAlignment.end,
                    //                       children: [
                    //                         SizedBox(
                    //                           width: 70.w,
                    //                           height: 16.w,
                    //                           child: Image.asset(StrUtils.getLevelImage(2)),
                    //                         ),
                    //                         SizedBox(width: 10.w,),

                    //                         SizedBox(
                    //                           child: Row(
                    //                             children: [
                    //                               SizedBox(
                    //                                 child: Text(playerInfoController.userDetailModel?.nickname ?? '', style: TextStyle(fontSize: 18.sp, color: const Color(0xff323232)),),
                    //                               ),
                    //                               SizedBox(width: 6.w,),
                    //                               SizedBox(
                    //                                 width: 14.w,
                    //                                 height: 14.w,
                    //                                 child: Image.asset(StrUtils.getSexImage(
                    //                                   int.parse('${playerInfoController.userDetailModel?.sex == '1' || playerInfoController.userDetailModel?.sex == '女' ? '1' : '2'}'))
                    //                                 ),
                    //                               )
                    //                             ],
                    //                           ),
                    //                         )
                    //                       ],
                    //                     ),
                    //                   )
                    //                 )
                    //               ],
                    //             ),

                    //             if (playerInfoController.userDetailModel?.isSelf != true) ...[
                    //               SizedBox(
                    //                 child: Row(
                    //                   children: [
                    //                     GestureDetector(
                    //                       behavior: HitTestBehavior.translucent,
                    //                       onTap: () {
                    //                         playerInfoController.praiseOrCancelPraise();
                    //                       },
                    //                       child: Container(
                    //                         decoration: BoxDecoration(
                    //                           color: playerInfoController.userDetailModel?.isPraised == true ? Colors.transparent : Colors.white,
                    //                           borderRadius: BorderRadius.circular(129.r),
                    //                           border: Border.all(
                    //                             width: 1.w,
                    //                             color: Colors.white
                    //                           )
                    //                         ),
                    //                         padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 6.w),
                    //                         child: Text(playerInfoController.userDetailModel?.isPraised == true ? '点赞' : '已点赞', style: TextStyle(fontSize: 12.sp, color: playerInfoController.userDetailModel?.isPraised == true ? Colors.white : const Color(0xff2A8747)),),
                    //                       ),
                    //                     ),


                    //                     SizedBox(width: 10.w,),


                    //                     if (playerInfoController.userDetailModel?.isFocused == true) ...[
                    //                       GestureDetector(
                    //                         behavior: HitTestBehavior.translucent,
                    //                         onTap: () {
                    //                           playerInfoController.focusOrCancelFocus();
                    //                         },
                    //                         child: Container(
                    //                           decoration: BoxDecoration(
                    //                             color: Colors.transparent,
                    //                             borderRadius: BorderRadius.circular(129.r),
                    //                             border: Border.all(
                    //                               width: 1.w,
                    //                               color: Colors.white
                    //                             )
                    //                           ),
                    //                           padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 6.w),
                    //                           child: Text('已关注', style: TextStyle(fontSize: 12.sp, color: Colors.white),),
                    //                         ),
                    //                       ),
                    //                     ] else ...[
                    //                       GestureDetector(
                    //                         behavior: HitTestBehavior.translucent,
                    //                         onTap: () {
                    //                           playerInfoController.focusOrCancelFocus();
                    //                         },
                    //                         child: Container(
                    //                           decoration: BoxDecoration(
                    //                             color: const Color(0xffFF6750),
                    //                             borderRadius: BorderRadius.circular(129.r),
                    //                             border: Border.all(
                    //                               width: 1.w,
                    //                               color: const Color(0xffFF6750),
                    //                             )
                    //                           ),
                    //                           padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 6.w),
                    //                           child: Row(
                    //                             children: [
                    //                               Icon(Icons.add, size: 14.sp, color: Colors.white,),
                    //                               SizedBox(width: 3.w),
                    //                               Text('关注', style: TextStyle(fontSize: 12.sp, color: Colors.white),)
                    //                             ],
                    //                           ),
                    //                         ),
                    //                       )
                    //                     ]


                                        
                    //                   ],
                    //                 )
                    //               )
                    //             ],

                                
                    //           ],
                    //         ),
                    //       )
                    //     )
                    //   ],
                    // ),
                  ],
                ),
              ),
            )
          ];
        },
        pinnedHeaderSliverHeightBuilder: () {
          return pinnedHeaderHeight;
        },
        body: SizedBox(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Expanded(
                child: SingleChildScrollView(
                  physics: const BouncingScrollPhysics(),
                  padding: EdgeInsets.symmetric(horizontal: 17.w),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Container(
                        padding: EdgeInsets.all(20.w),
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(12.r)
                        ),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            _topAndBottomWidget(txt: '出场', val: '${playerInfoController.userDetailModel?.matchCount ?? '0'}'),
                            _topAndBottomWidget(txt: '点赞', val: '${playerInfoController.userDetailModel?.praisedCount ?? '0'}'),
                            _topAndBottomWidget(txt: '被关注', val: '${playerInfoController.userDetailModel?.focusCount ?? '0'}'),
                            _topAndBottomWidget(txt: '水率', val: playerInfoController.userDetailModel?.breakAppointmentRate ?? '0%'),
                          ],
                        ),
                      ),

                      SizedBox(height: 16.w,),

                      Container(
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(12.r)
                        ),
                        child: Column(
                          children: [
                            _leftAndRightWidget(leftText: '年龄', rightText: playerInfoController.userDetailModel?.age ?? '未知'),
                            Container(width: double.infinity, height: 0.5.w, color: const Color(0xffE5E5E5), margin: EdgeInsets.symmetric(horizontal: 12.w)),

                            _leftAndRightWidget(leftText: '性别', rightText: playerInfoController.userDetailModel?.sex ?? '未知'),
                            Container(width: double.infinity, height: 0.5.w, color: const Color(0xffE5E5E5), margin: EdgeInsets.symmetric(horizontal: 12.w)),

                            _leftAndRightWidget(leftText: '身高', rightText: playerInfoController.userDetailModel?.height ?? '未知'),
                            Container(width: double.infinity, height: 0.5.w, color: const Color(0xffE5E5E5), margin: EdgeInsets.symmetric(horizontal: 12.w)),

                            _leftAndRightWidget(leftText: '体重', rightText: playerInfoController.userDetailModel?.weight ?? '未知'),
                          ],
                        ),
                      ),


                      SizedBox(height: 16.w,),

                      Container(
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(12.r)
                        ),
                        child: Column(
                          children: [
                            _leftAndRightWidget(leftText: '生日', rightText: playerInfoController.userDetailModel?.birthday ?? '未知'),
                            
                            Container(width: double.infinity, height: 0.5.w, color: const Color(0xffE5E5E5), margin: EdgeInsets.symmetric(horizontal: 12.w)),

                            _leftAndRightWidget(leftText: '地区', rightText: playerInfoController.userDetailModel?.areaName == null ? '未知' : '${playerInfoController.userDetailModel?.areaName ?? ''}'),
                          ],
                        ),
                      ),



                      SizedBox(height: 16.w,),

                      Container(
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(12.r)
                        ),
                        child: Column(
                          children: [
                            _leftAndRightWidget(leftText: '擅长位置', rightText: playerInfoController.goodPositionCode.length <= 0 ? '未知' : playerInfoController.goodPositionCode.join(',')),
                          ],
                        ),
                      ),


                      if (type != CustomConstant.USER_JB_INFO) ...[
                        SizedBox(height: 16.w,),

                        Container(
                          decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(12.r)
                          ),
                          child: Column(
                            children: [
                              _leftAndRightWidget(leftText: '加入俱乐部日期', rightText: playerInfoController.userDetailModel?.joinedDate ?? '未知'),
                            ],
                          ),
                        ),
                      ],
                      

                      

                      if ((playerInfoController.userDetailModel?.joinedClubList?.length ?? 0) > 0) ...[
                        SizedBox(height: 21.w,),

                        SizedBox(
                          child: Row(
                            children: [
                              Container(
                                width: 3.w,
                                height: 14.w,
                                color: const Color(0xff499360 ),
                              ),
                              SizedBox(width: 8.w,),
                              Expanded(// 499360
                                child: Text('已加入俱乐部', style: TextStyle(fontSize: 16.sp, color: const Color(0xff323232), fontWeight: FontWeight.bold),),
                              ),
                            ],
                          ),
                        ),

                        SizedBox(height: 17.w,),

                        SizedBox(
                          height: 120.w,
                          child: ListView.separated(
                            itemCount: playerInfoController.userDetailModel?.joinedClubList?.length ?? 0,
                            padding: EdgeInsets.zero,
                            shrinkWrap: true,
                            scrollDirection: Axis.horizontal,
                            physics: const BouncingScrollPhysics(),
                            separatorBuilder: (context, index) {
                              return SizedBox(width: 47.w,);
                            },
                            itemBuilder: (BuildContext context, int index) {
                              return SizedBox(
                                child: Column(
                                  children: [
                                    SizedBox(
                                      width: 80.w,
                                      height: 80.w,
                                      child: ClipRRect(
                                        borderRadius: BorderRadius.circular(10.r),
                                        child: Image.network(playerInfoController.userDetailModel?.joinedClubList?[index].clubImgUrl ?? '', fit: BoxFit.fill,),
                                      ),
                                    ),

                                    SizedBox(height: 10.w,),

                                    SizedBox(
                                      child: Text(playerInfoController.userDetailModel?.joinedClubList?[index].clubName ?? '', style: TextStyle(fontSize: 14.sp, color: const Color(0xff323232), fontWeight: FontWeight.w500),),
                                    )
                                  ],
                                ),
                              );
                            },
                          ),
                        )
                      ],

                      
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }


  _topAndBottomWidget({
    String val = '',
    String txt = ''
  }) {
    return SizedBox(
      child: Column(
        children: [
          SizedBox(
            child: Text(val, style: TextStyle(fontSize: 18.sp, fontWeight: FontWeight.w500, color: const Color(0xff333333)),),
          ),

          SizedBox(height: 3.w,),

          SizedBox(
            child: Text(txt, style: TextStyle(fontSize: 12.sp, color: const Color(0xff999999)),),
          )
        ],
      ),
    );
  }

  _leftAndRightWidget({
    String leftText = '',
    String rightText = '',
  }) {
    return Container(
      padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 12.w),
      child: Row(
        children: [
          SizedBox(
            child: Text(leftText, style: TextStyle(fontSize: 15.sp, color: const Color(0xff323232)),),
          ),

          const Spacer(),

          SizedBox(
            child: Text(rightText, style: TextStyle(fontSize: 14.sp, color: const Color(0xff999999), height: 1.5),),
          )
        ],
      ),
    );
  }






  _showMenu(PlayerInfoController playerInfoController) {
    showMenu(
      color: Colors.white, //弹出框的颜色
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.all(
          Radius.circular(6.r)
        )
      ), //给弹出框添加一个圆角形状
      elevation: 10,
      context: Get.context!,
      position: const RelativeRect.fromLTRB(100, 80, 0, 0),
      items: <PopupMenuEntry>[
        _popupMenuItem(text: '强水标记', icon: 'assets/images/icon_mark.png', onTap: () {
          AbsenteeismDialog.show(
            Get.context!,
            cancelTap: () {
              Get.back();
            },
            confirmTap: () {
              playerInfoController.absentMark();
            }
          );
        }),

        const PopupMenuDivider(),

        _popupMenuItem(text: '管理', icon: 'assets/images/icon_manager.png', onTap: () {
          ManageDialog.show(
            Get.context!,
            cancelTap: () {
              Get.back();
            },
            confirmTap: () {
              playerInfoController.clubMemberAppoint();
            }
          );
        }),
      ]
    );
  }

  _popupMenuItem({
    String icon = '',
    String text = '',
    Function? onTap
  }) {
    return PopupMenuItem(
      padding: const EdgeInsets.symmetric(horizontal: 10,),
      height: 24.w,
      child: SizedBox(
        width: 86.w,
        height: 15.w,
        child: Row(
          children: [
            Image.asset(icon),
            Padding(padding: EdgeInsets.only(left: 8.w)),
            Text(text, style: TextStyle(color: const Color(0xff333333), fontSize: 11.sp),),
          ],
        ),
      ),
      onTap: () {
        Future.delayed(const Duration(milliseconds: 100), (){
          onTap?.call();
        });
      },
    );
  }



}